package com.allwees.bs.module.ops.req.query;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.allwees.bs.core.modelbase.req.QueryReq;
import com.allwees.bs.module.ops.entity.AppVersion;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 *
 *
 * @author yangylsky
 * @since 2019-08-29
 *
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AppVersionQueryReq extends QueryReq<AppVersion> {
    private static final long serialVersionUID = 6372854765371710920L;

    private String platForm;

    private String channel;

    private String createDateBegin;

    private String createDateEnd;

    private Integer updateType;

    public final void buildQuery(QueryWrapper<AppVersion> queryWrapper) {
        queryWrapper.eq(StringUtils.isNotBlank(channel),"channel",channel)
                .eq(StringUtils.isNotBlank(platForm),"platform",platForm)
                .eq(updateType != null,"update_type",updateType)
                .ge( createDateBegin != null, "created_at", createDateBegin)
                .le(createDateEnd != null, "created_at", createDateEnd);


    }
}
